/*
 * p1696.cpp
 *
 *  Created on: 2013-3-16
 *      Author: zy
 */

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;

const double EPS=1e-8;

int sig(double d)
{
	return fabs(d) < EPS ? 0 : d < 0 ? -1 : 1;
}
struct Point{
	double x,y;
	int idx;
	Point(){}
	Point(double x,double y): x(x),y(y){}
	void set(double x,double y){
		this->x=x;
		this->y=y;
	}
	bool operator <(const Point &p)const{
		return sig(y-p.y) !=0 ? y < p.y : sig(x - p.x) < 0;
	}
};

double cross(Point o,Point a,Point b){
	return (a.x-o.x)*(b.y-o.y)-(b.x-o.x)*(a.y-o.y);
}
double dot(Point o,Point a,Point b){
	return (a.x-o.x)*(b.x-o.x)+(a.y-o.y)*(b.y-o.y);
}

int btw(Point x,Point a,Point b){
	return sig(dot(x,a,b));
}
Point p[61];
bool vis[61];
int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		int n,fi=1;
		memset(vis,0,sizeof(vis));
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			cin>>p[i].idx>>p[i].x>>p[i].y;
			if(p[i]<p[fi])fi=i;
		}
		int cnt=1,ans[60];
		ans[1]=fi;vis[fi]=1;
		while(1)
		{
			int nex=0,s;
			for(int i=1;i<=n;i++)
			{
				if(vis[i])continue;
				if(!nex){nex=i;continue;}
				if((s=cross(p[fi],p[nex],p[i]))<0)nex=i;
				if(s==0&&btw(p[i],p[nex],p[fi])<0)nex=i;
			}
			if(nex==0)break;
			cnt++;ans[cnt]=nex;vis[nex]=true;
			fi=nex;
		}
		cout<<cnt;
		for(int i=1;i<=cnt;i++)
			cout<<" "<<ans[i];
		cout<<endl;
	}
	return 0;
}

